﻿using Function;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using UI.UserControl.Base;
using UI.UserControl.UI;

namespace UI.Module.InvestmentIncome
{
    public partial class ShopBuildMoneyList: System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                ViewState["condition"] = "BuildID=" + Request.QueryString["BuildID"];
            }
        }
        string Message = "";
        private void Bind(string Where_String = "")
        {
            int RecordCount = 0;
            DataTable Page_Dt = new DataTable();
            Page_Dt = BLL.PageQuery2005_BLL.SelectPage(out RecordCount, "ID, ShopID, (SELECT STitle FROM dbo.ST_Shop WHERE dbo.ST_Shop.ID=ShopID) AS shopName,BuildID, (SELECT Item FROM DY_ShopBuildMoney WHERE Code=BulidItem) as itemNAME, PayItem, PayMoney, PayTime ", "[ST_ShopBuildMoneyDetail]", Where_String , "[ID] desc", Pager.CurrentPageIndex,Pager.PageSize, PubConstant.DataBaseTarget.JHShop, out Message);

            if (!string.IsNullOrEmpty(Message))
            {
                MessageBox box = new MessageBox();
                box.ErrorBox(this, "数据查询失败!");
                return;
            }
            grdlist.DataSource = Page_Dt;
            grdlist.DataBind();
            this.Pager.RecordCount = RecordCount;
        }

        protected void grdlist_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowIndex != -1)
            {
                int indexID = (this.Pager.CurrentPageIndex - 1) * this.Pager.PageSize + e.Row.RowIndex + 1;
                e.Row.Cells[0].Text = indexID.ToString();
            }
        }

        protected void Pager_BindData(object sender, EventArgs e)
        {
            Bind(ViewState["condition"].ToString());
        }
    }
}